<template>
  <NavBar :title="title"/>
  <router-view ref="component" v-slot="{ Component }">
    <transition>
      <div>
        <keep-alive>
          <component :is="Component" />
        </keep-alive>
      </div>
    </transition>
  </router-view>
</template>

<script>
import NavBar from "@/components/NavBar.vue";

export default {
  name: "App",
  components: {NavBar},
  data(){
    return {
      title: '活动'
    }
  },
  watch: {
    '$route'(to, from) {
      // 在路由变化时触发，您可以在这里设置导航栏标题
      this.title  = to.meta.title || '活动';
    }
  },
}
</script>

<style scoped>

</style>